package com.ctshk.rpc.order.custom.code;

import java.util.Objects;

public enum GenderCode {

    MR(1, "先生"),
    MS(2, "女士"),
    MISS(3, "小姐"),
    BOY(4, "男童"),
    GIRL(5, "女童"),
    ;

    private Integer code;
    private String msg;

    GenderCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public static Integer getCode(String msg) {
        for (GenderCode value : values()) {
            if (Objects.equals(value.getMsg(), msg)) {
                return value.getCode();
            }
        }
        return null;
    }
}
